home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 30
/
PC Gamer IT CD 30 1-2.iso
/
MOTS
/
GAMEDATA
/
RESOURCE
/
JKMRES.GOO
/
cog_weap_railseek_m.cog
< prev
next >
Wrap
Text File
|
1998-02-25
|
16KB
|
525 lines
# Jedi Knight Missions Cog Script
#
# WEAP_RAILSEEK_M.COG
#
# WEAPON 17 Script - Seeking Rail Detonator Gun
#
# This is a missile launcher type of weapon. It sends out an explosive device with
# two options, impact or trigger explosion. The charge with the trigger option will
# stick to a wall.
#
# - Not affected by MagSealed sectors/surfaces.
#
# [YB & CYW] + [RF]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
symbols
model povModel=skrv.3do local
model povModel_m=skrv_m.3do local
model weaponMesh=skrg.3do local
sound mountSound=RailChargeArm01.WAV local
sound dismountSound=PutWeaponAway01.wav local
sound fireSound=RailChargeFire01.WAV local
sound outSound=RailChargeEmpty01.WAV local
sound failSound=weapfail.wav local
thing player local
keyframe mountAnim=RldVmnt.key local
keyframe dismountAnim=RldVdis.key local
keyframe povfireAnim=RldVpst1.key local
keyframe holsterAnim=kyhlstr.key local
template projectileB=+dudseek local
template lprojectile=+lhraildet local
template projectile=+hraildet local
template projectile2=+hraildet2 local
template sprojectile=+raildet local
template sprojectile2=+raildet2 local
template NCRail=+nchraildet local
template NCRail2=+nchraildet2 local
template gtemp=ghost local
thing moochGhost=-1 local
int oldFlags local
#template exp=+raildet_exp local
thing rail local
thing target local
flex fireWait=1.0 local
flex powerBoost local
flex autoAimFOV=1 local
flex holsterWait local
flex fMaxDot local
flex dot local
thing tMaybe local
keyframe railAnim=rld0anim.key local
int trackID=-1 local
int mode local
int holsterTrack local
int iShotCounter=0 local
int selectMode=1 local
int data local
int i local
#int j local
#int k local
#int m local
#thing RLauncher local
#thing RTarget local
#thing RProjectile local
#int RailSlotID local
#int RailSlotID2 local
#int RailSlotID3 local
#int RailSlotID4 local
#int RailSlotID5 local
#int RailSlotID6 local
#int RailSlotID7 local
#int RailSlotID8 local
#int RailSlotID9 local
#int RailSlotID10 local
#int RailSlotID11 local
#int RailSlotID12 local
#int RailSlotID13 local
#int RailSlotID14 local
#int RailSlotID51 local
#int RailSlotID16 local
#int RailSlotID17 local
#int RailSlotID18 local
#int RailSlotID19 local
#int RailSlotID20 local
#
#int RailSlotDest local
#int RailSlotDest2 local
#int RailSlotDest3 local
#int RailSlotDest4 local
#int RailSlotDest5 local
#int RailSlotDest6 local
#int RailSlotDest7 local
#int RailSlotDest8 local
#int RailSlotDest9 local
#int RailSlotDest10 local
#int RailSlotDest11 local
#int RailSlotDest12 local
#int RailSlotDest13 local
#int RailSlotDest14 local
#int RailSlotDest51 local
#int RailSlotDest16 local
#int RailSlotDest17 local
#int RailSlotDest18 local
#int RailSlotDest19 local
#int RailSlotDest20 local
#
#thing RailSlotThing local
#thing RailSlotThing2 local
#thing RailSlotThing3 local
#thing RailSlotThing4 local
#thing RailSlotThing5 local
#thing RailSlotThing6 local
#thing RailSlotThing7 local
#thing RailSlotThing8 local
#thing RailSlotThing9 local
#thing RailSlotThing10 local
#thing RailSlotThing11 local
#thing RailSlotThing12 local
#thing RailSlotThing13 local
#thing RailSlotThing14 local
#thing RailSlotThing51 local
#thing RailSlotThing16 local
#thing RailSlotThing17 local
#thing RailSlotThing18 local
#thing RailSlotThing19 local
#thing RailSlotThing20 local
#message startup
message activated
message deactivated
message selected
message deselected
#message newplayer
message autoselect
message fire
message timer
#message trigger
end
# ========================================================================================
code
//startup:
// for (i = 0; i < 20; i = i + 1)
// RailSlotID[i] = -1;
// return;
fire:
player = GetSourceRef();
mode = GetSenderRef();
// Check that the player is still alive.
if(GetThingHealth(player) <= 0)
{
Return;
}
// Check Ammo - If we are out, autoselect best weapon.
if(GetInv(player, 91) < 1.0)
{
PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);
if(GetAutoSwitch() & 1)
SelectWeapon(player, GetWeaponBin(AutoSelectWeapon(player, 1)));
Return;
}
SendMessageEx(GetThingClassCog(GetLocalPlayerThing()), user1, 3, 0, 0, 0);
jkPlayPOVKey(player, povfireAnim, 1, 0x38);
SetPOVShake('0.0 -.01 0.0', '4.0 0.0 0.0', .05, 80.0);
if (GetInv(player, 93) > 0.0)
{
mode = 2;
rail = FireProjectile(player, projectileB, failSound, 18, '0.0214 0.15 0.00', '0 0 0', 1.0, 0x00, 1, 1);
}
else
{
tMaybe = FirstThingInView(player, 120, 100, 0x404);
fMaxDot = -1;
target = -1;
// Search for the thing with the highest dot.
while (tMaybe != -1)
{
dot = ThingViewDot(player, tMaybe);
if ((dot > fMaxDot) && (player != tMaybe))
{
target = tMaybe;
fMaxDot = dot;
}
tMaybe = NextThingInView();
}
// target = player;
if (target != -1)
{
data = target;
if (mode == 0)
data = data + 5000;
rail = FireProjectileData(player, lprojectile, fireSound, 18, '0.0214 0.15 0.00', '0 0 0', 1.0, 0x20, 1, 1, data);
}
else
{
rail = FireProjectile(player, sprojectile[mode], fireSound, 18, '0.0214 0.15 0.00', '0 0 0', 1.0, 0x20, 1, 1);
}
}
// Provide a kick backwards
if (mode != 2)
ApplyForce(player, VectorScale(GetThingLVec(player), -40));
else
SendMessageEx(GetThingClassCog(player), skill, 1100, 0, 0, 0);
ChangeInv(player, 91, -1.0);
powerBoost = GetInv(player, 63);
ChangeFireRate(player, fireWait/powerBoost);
Return;
# ........................................................................................
activated:
player = GetSourceRef();
mode = GetSenderRef();
jkSetWaggle(player, '0.0 0.0 0.0', 0);
powerBoost = GetInv(player, 63);
ActivateWeapon( player, fireWait/powerBoost, mode );
Return;
# ........................................................................................
deactivated:
player = GetSourceRef();
mode = GetSenderRef();
jkSetWaggle(player, '10.0 7.0 0.0', 350);
DeactivateWeapon( player, mode );
Return;
# ........................................................................................
selected:
player = GetSourceRef();
if (moochGhost == -1)
{
moochGhost = CreateThing(gTemp, GetLocalPlayerThing());
SetThingParent(moochGhost, GetThingGuid(GetLocalPlayerThing()));
}
PlayMode(player, 41);
PlaySoundThing(mountSound, player, 1.0, -1, -1, 0x80);
if (GetInv(player, 67) == 0.0)
jkSetPOVModel(player, povModel); // Kyle hand
else
jkSetPOVModel(player, povModel_m); // Mara Hand
SetArmedMode(player, 1);
jkSetWeaponMesh(player, weaponMesh);
jkSetWaggle(player, '10.0 7.0 0.0', 350);
trackID = jkPlayPOVKey(player, mountAnim, 0, 20);
SetMountWait(player, GetKeyLen(mountAnim));
jkClearFlags(player, 0x5);
SetCurWeapon(player, GetWeaponBin(17));
// Check Ammo - If we are out, autoselect best weapon.
if(GetInv( player, 91 ) < 1.0)
{
PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);
if(GetAutoSwitch() & 1)
SelectWeapon(player, GetWeaponBin(AutoSelectWeapon(player, 1)));
}
Return;
# ........................................................................................
deselected:
player = GetSourceRef();
PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
jkPlayPOVKey( player, dismountAnim, 0, 18 );
holsterWait = GetKeyLen(holsterAnim);
SetMountWait(player, holsterWait);
holsterTrack = PlayKey(player, holsterAnim, 1, 0x4);
SetTimerEx(holsterWait, 2, 0.0, 0.0);
if (trackID != -1)
{
jkStopPOVKey( player, trackID, 0 );
trackID = -1;
}
jkSetWaggle(player, '0.0 0.0 0.0', 0);
Return;
# ........................................................................................
//newplayer:
// player = GetSourceRef();
//
// // Make sure that if the player is respawning, the old mount isn't playing anymore.
// if (trackID != -1)
// jkStopPOVKey(player, trackID, 0);
//
// Return;
# ........................................................................................
autoselect:
selectMode = GetSenderRef();
player = GetSourceRef();
// If the player has the weapon
if(GetInv(player, GetWeaponBin(17)) != 0.0)
{
// If the player has ammo
if(GetInv(player, 91) != 0.0)
{
// query for ammo
if(selectMode == -1)
{
ReturnEx(901.0);
Return;
}
if((selectMode == 0) && !(GetAutoPickup() & 2))
{
ReturnEx(901.0);
Return;
}
if((selectMode == 1) && !(GetAutoSwitch() & 2))
{
ReturnEx(901.0);
Return;
}
if((selectMode == 2) && !(GetAutoPickup() & 2))
{
ReturnEx(901.0);
Return;
}
ReturnEx(-2.0);
Return;
}
else
{
ReturnEx(-1.0);
Return;
}
}
else
{
ReturnEx(-1.0);
}
Return;
# ........................................................................................
timer:
if (GetSenderID() == 2)
{
StopKey(player, holsterTrack, 0.0);
}
// else if (GetSenderID() == 3500)
// {
// SetWeaponTarget(GetParam(0), GetParam(1), 450.0);
// }
Return;
//# ........................................................................................
//
//trigger:
// // Handle Seeking Rail Dets
// if(GetSourceRef() == 3500 || GetSourceRef() == 3501)
// {
// //print("Creating Rail Det!");
//
// // Add this rail det to the projectile list (so that it
// // can be destroyed when it's doppelganger explodes).
// for (m = 0; m < 20; m = m + 1)
// {
// if (RailSlotID[m] == -1)
// {
// RailSlotID[m] = GetParam(2);
//
// j = m;
//
// // Break the for loop.
// m = 30;
// }
// }
//
// // If there were no slots open, don't allow the rail det to be created
// // (we would wind up with a rail det buzzing around over someone's head
// // like an angry hornet, but never exploding).
// if (m == 20)
// {
// //print("No Slots available!");
// return;
// }
//
// m = j;
//
// RLauncher = GetParam(0);
// RTarget = GetParam(1);
//
// if (RTarget == GetLocalPlayerThing())
// {
//// print("Firing Live Round!");
//
// if (GetSourceRef() == 3500)
// RProjectile = FireProjectileLocal(RLauncher, projectile, fireSound, 18, '0.0214 0.15 0.00', '0 0 0', 1.0, 0x20, 1, 1);
// else
// RProjectile = FireProjectileLocal(RLauncher, projectile2, fireSound, 18, '0.0214 0.15 0.00', '0 0 0', 1.0, 0x20, 1, 1);
// }
// else
// {
//// print("Firing Dummy Round!");
//
// if (GetSourceRef() == 3500)
// RProjectile = FireProjectileLocal(RLauncher, NCRail, fireSound, 18, '0.0214 0.15 0.00', '0 0 0', 1.0, 0x20, 1, 1);
// else
// RProjectile = FireProjectileLocal(RLauncher, NCRail2, fireSound, 18, '0.0214 0.15 0.00', '0 0 0', 1.0, 0x20, 1, 1);
// }
//
//// print("Marking Projectile!");
//
// if (RProjectile != -1)
// {
// // Note down the reference of this seeker.
// SetThingUserData(RProjectile, m);
//
// // Make sure ownership is correct.
// SetThingParent(RProjectile, GetThingGuid(RLauncher));
//
// // Note down the projectile thing.
// RailSlotThing[m] = RProjectile;
// RailSlotDest[m] = RLauncher;
//
//// Sleep(3.0);
//
// SetTimerEx(0.3, 3500, RProjectile, RTarget);
// }
// else
// {
// RailSlotID[m] = -1;
// }
// }
// else if(GetSourceRef() == 3502) // Destroy a dummy seeker
// {
// //print("Destroying Ghost Rail Det!");
//
// // Search the list for a match.
// for (k = 0; k < 20; k = k + 1)
// if (RailSlotID[k] == GetParam(0))
// if (RailSlotDest[k] == GetParam(1))
// {
// DestroyThing(RailSlotThing[k]);
// RailSlotID[k] = -1;
//
// k = 30;
// }
// }
// else if(GetSourceRef() == 3503) // Destroy a real seeker
// {
// //print("Destroying Real Rail Det!");
//
// i = GetParam(0);
// j = RailSlotID[i];
//
// if (j != -1)
// {
// RailSlotID[i] = -1;
//
// CreateThingAtPosOwner(exp, GetThingSector(GetParam(1)), GetThingPos(GetParam(1)), '0 0 0', RailSlotDest[i]);
//// SendTrigger(RailSlotDest[i], 3504, VectorX(GetThingPos(GetParam(1))), VectorY(GetThingPos(GetParam(1))), VectorZ(GetThingPos(GetParam(1))), GetThingSector(GetParam(1)));
// SendTrigger(-1, 3502, j, RailSlotDest[i], 0, 0);
// }
// }
// else if(GetSourceRef() == 3504) // Create an explosion
// {
// CreateThingAtPosOwner(exp, GetParam(3), VectorSet(GetParam(0), GetParam(1), GetParam(2)), '0 0 0', GetLocalPlayerThing());
// }
//
// Return;
end